package com.leonardo.beanme.fields.impl;

import javax.microedition.lcdui.TextField;

import com.leonardo.beanme.fields.abs.TextInput;

public final class DoubleInput extends TextInput {

	private static final int FIELD_CONSTRAINT = TextField.DECIMAL;
	
	public DoubleInput() {
		super(FIELD_CONSTRAINT);
	}
	
	public Object getValue() {
		String value = ((TextField)getField()).getString();
		return invalidValue(value) ? getDefaultValue() : Double.valueOf(value);  
	}
	
	public Object getDefaultValue() {
		return new Double(0);
	}
	
}
